<?php
/**
 * 奖品表
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAwardGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('award_goods', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('activity_id')->comment('活动ID');
            $table->string('name')->nullable()->comment('奖品名称');
            $table->tinyInteger('num')->default(1)->comment('用户获取相应奖品的数量');
            $table->integer('img')->comment('奖品图片');
            $table->integer('stock')->comment('奖品数量');
            $table->integer('probability')->comment('中奖概率 整数');
            $table->integer('max_num')->comment('多少次出现一次中奖 例如：1000次之内必中');
            $table->tinyInteger('is_show')->default(1)->comment('是否显示 1是2否');
            $table->integer('sort')->default(1)->comment('排序');
            $table->timestamps();
            $table->softDeletes();
        });
        //添加表注释
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."award_goods` comment'奖品表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('award_goods');
    }
}
